package pl.com.sjap.agenci;
import CLIPSJNI.Environment;
import CLIPSJNI.MultifieldValue;
public class Fee {
	private String kto;
	private String ile;
	private String status;
	
	public Fee(String kto, 
			String ile, String status) {
		super();
		this.kto = kto;
		this.ile = ile;
		this.status = status;		
		
	}
	public Fee(){}
	public String getAboutFee(Environment clipse){
		MultifieldValue bohatercl = (MultifieldValue) clipse
				.eval("(find-all-facts ((?f napiwek)) TRUE)");
		try {
			this.setKto(bohatercl.get(0).getFactSlot("kto").toString());
			this.setIle(bohatercl.get(0).getFactSlot("ile").toString());
			this.setStatus(bohatercl.get(0).getFactSlot("status").toString());
			
		} catch (Exception e) {
			// TODO Auto-generated catch block
			e.printStackTrace();
		}
		return "napiwek[(kto " + kto +")(ile " + ile + ")(status "+ status + ")]";
	}
	
	public String changeNapiwek(String ile, Environment clipse){
		this.ile = ile;
		this.status = "tak";
		clipse.assertString(addFee());
		return "(napiwek (kto " + kto + ")(ile " + ile + ")(status " + status + "))";
	}
	
	public String changeNapiwek2(String ile, Environment clipse){
		this.ile = "0";
		this.status = "bez";
		clipse.assertString(addFee());
		return "(napiwek (kto " + kto + ")(ile " + ile + ")(status " + status + "))";
	}
	
	public String addFee(){	
		return "(napiwek (kto " + kto + ")(ile " + ile + ")(status " + status + "))";
	}
	
	public String getKto() {
		return kto;
	}

	public void setKto(String kto) {
		this.kto = kto;
	}

	public String getIle() {
		return ile;
	}

	public void setIle(String ile) {
		this.ile = ile;
	}

	public String getStatus() {
		return status;
	}

	public void setStatus(String status) {
		this.status = status;
	}
}
